<%@ page import="com.ssmm.ssmm1.pojo.Userr" %>
<%@ page import="java.util.List" %>
<%@ page import="com.ssmm.ssmm1.service.UserService" %>
<%@ page import="org.springframework.beans.factory.annotation.Autowired" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: naojiang
  Date: 2017/7/14
  Time: 11:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>权限管理系统</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/login.css">
    <link rel="stylesheet" href="css/bootstrapValidator.css">
</head>
<body>
<form name="form1" action="/user/list" method="post" >
    <div class="table-responsive">
        <table class="table table-striped table-bordered table-hover">

            <thead>
            <tr>
                <td>用户名查询:</td>
                <td><input type="text" name="username"></td>
                <td><input class="btn btn-default" type="submit" name="submit" value="查询"/></td>
            </tr>
        <tr>
            <th>标识</th><th>用户名</th><th>密码</th><th>昵称</th><th>性别</th><th>地址</th>
        </tr>
            </thead>
            <tbody>
        <%
            List<Userr> list1 = new ArrayList<Userr>();
            list1 = (List<Userr>) session.getAttribute("list1");
            Userr userr = (Userr) session.getAttribute("user1");
            for(Userr u1:list1){
                System.out.println(u1);
            }
            for(Userr u:list1){
                if(u.getUsername().equals(userr.getUsername())){
        %>
        <tr class="success">
            <td><%=u.getId() %></td>
            <td><%=u.getUsername() %></td>
            <td><%=u.getPassword() %></td>
            <td><%=u.getNickname() %></td>
            <td><%=u.getSex() %></td>
            <td><%=u.getAddress() %></td>
            <td><a class="btn btn-default" href="/user/updatenormal?username=<%=u.getUsername()%>">修改</a></td>
        </tr>
        <%
                }else{
        %>
        <tr>
            <td><%=u.getId() %></td>
            <td><%=u.getUsername() %></td>
            <td><%="******" %></td>
            <td><%=u.getNickname() %></td>
            <td><%=u.getSex() %></td>
            <td><%=u.getAddress() %></td>
        </tr>
        <%
                }
            }

        %>
            </tbody>
    </table>
</form>
<a class="btn btn-default" href="/user/login" role="button">返回登录页面</a>
<script src="js/jquery-3.0.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrapValidator.js"></script>
<script src="js/language/zh_CN.js"></script>
</body>
</html>
